home *** CD-ROM | disk | FTP | other *** search
- package assets.buildings
- {
- import assets.buildings.parts.*;
- import flash.display.*;
- import flash.events.*;
- import flash.geom.Point;
-
- [Embed(source="/_assets/assets.swf", symbol="assets.buildings.building2")]
- public class building2 extends MovieClip
- {
-
-
- public var pp:Point;
-
- public var deep:Number = 40;
-
- public var space:Number = 20;
-
- public var scope:Object;
-
- public var planes:Array;
-
- public var dist:Number;
-
- public var wide:Number = 202;
-
- public function building2(param1:*)
- {
- pp = new Point(350 + 150,200);
- deep = 40;
- wide = 202;
- space = 20;
- planes = new Array();
- super();
- scope = param1;
- setData();
- addEventListener(Event.ENTER_FRAME,render);
- addEventListener(Event.REMOVED_FROM_STAGE,onRemove);
- }
-
- public function setData() : *
- {
- planes.push({
- "A":new Point(202,0),
- "B":new Point(202,-20),
- "cl":6710886,
- "al":1
- });
- planes.push({
- "A":new Point(202,-20),
- "B":new Point(200,-20),
- "cl":10066329,
- "al":1
- });
- planes.push({
- "A":new Point(200,-20),
- "B":new Point(200,-290),
- "cl":6697728,
- "al":1
- });
- planes.push({
- "A":new Point(200,-290),
- "B":new Point(202,-290),
- "cl":3355443,
- "al":1
- });
- planes.push({
- "A":new Point(202,-290),
- "B":new Point(202,-310),
- "cl":6710886,
- "al":1
- });
- planes.push({
- "A":new Point(202,-310),
- "B":new Point(210,-310),
- "cl":3355443,
- "al":1
- });
- planes.push({
- "A":new Point(210,-310),
- "B":new Point(210,-320),
- "cl":6710886,
- "al":1
- });
- planes.push({
- "A":new Point(-202,0),
- "B":new Point(-202,-20),
- "cl":6710886,
- "al":1
- });
- planes.push({
- "A":new Point(-202,-20),
- "B":new Point(-200,-20),
- "cl":10066329,
- "al":1
- });
- planes.push({
- "A":new Point(-200,-20),
- "B":new Point(-200,-290),
- "cl":6697728,
- "al":1
- });
- planes.push({
- "A":new Point(-200,-290),
- "B":new Point(-202,-290),
- "cl":3355443,
- "al":1
- });
- planes.push({
- "A":new Point(-202,-290),
- "B":new Point(-202,-310),
- "cl":6710886,
- "al":1
- });
- planes.push({
- "A":new Point(-202,-310),
- "B":new Point(-210,-310),
- "cl":3355443,
- "al":1
- });
- planes.push({
- "A":new Point(-210,-310),
- "B":new Point(-210,-320),
- "cl":6710886,
- "al":1
- });
- }
-
- public function onRemove(param1:Event) : *
- {
- removeEventListener(Event.ENTER_FRAME,render);
- removeEventListener(Event.REMOVED_FROM_STAGE,onRemove);
- }
-
- public function drawPlane(param1:*) : *
- {
- var _loc2_:* = undefined;
- var _loc3_:* = undefined;
- var _loc4_:* = undefined;
- var _loc5_:* = undefined;
- var _loc6_:* = undefined;
- var _loc7_:* = undefined;
- var _loc8_:* = undefined;
- var _loc9_:* = undefined;
- var _loc10_:* = undefined;
- var _loc11_:* = undefined;
- var _loc12_:* = undefined;
- var _loc13_:* = undefined;
- _loc2_ = new Point(pp.x - (x + param1.A.x),pp.y - y);
- _loc3_ = Math.atan2(_loc2_.y,_loc2_.x);
- _loc4_ = -deep * (1 / Math.tan(_loc3_));
- _loc5_ = new Point(pp.x - (x + param1.A.x),pp.y - (y + param1.A.y));
- _loc6_ = Math.atan2(_loc5_.y,_loc5_.x);
- _loc7_ = _loc4_ * Math.tan(_loc6_);
- _loc8_ = new Point(pp.x - (x + param1.B.x),pp.y - y);
- _loc9_ = Math.atan2(_loc8_.y,_loc8_.x);
- _loc10_ = -deep * (1 / Math.tan(_loc9_));
- _loc11_ = new Point(pp.x - (x + param1.B.x),pp.y - (y + param1.B.y));
- _loc12_ = Math.atan2(_loc11_.y,_loc11_.x);
- _loc13_ = _loc10_ * Math.tan(_loc12_);
- graphics.beginFill(param1.cl,param1.al);
- graphics.moveTo(param1.A.x,param1.A.y);
- graphics.lineTo(param1.A.x + _loc4_,param1.A.y + _loc7_);
- graphics.lineTo(param1.B.x + _loc10_,param1.B.y + _loc13_);
- graphics.lineTo(param1.B.x,param1.B.y);
- graphics.lineTo(param1.A.x,param1.A.y);
- graphics.endFill();
- }
-
- public function render(param1:Event) : *
- {
- var _loc2_:* = undefined;
- graphics.clear();
- _loc2_ = 0;
- while(_loc2_ < planes.length)
- {
- drawPlane(planes[_loc2_]);
- _loc2_++;
- }
- }
-
- public function addElements() : *
- {
- var _loc1_:* = undefined;
- var _loc2_:* = undefined;
- var _loc3_:* = undefined;
- var _loc4_:MovieClip = null;
- _loc1_ = new Point(pp.x - x,pp.y - y);
- _loc2_ = Math.atan2(_loc1_.y,_loc1_.x);
- _loc3_ = 1 / Math.tan(_loc2_);
- (_loc4_ = new step3()).x = x + 145 + _loc4_.deep * _loc3_;
- _loc4_.y = 340;
- scope.elementArray.push(_loc4_);
- scope.element.addChild(_loc4_);
- }
- }
- }
-